Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs code demos #201

Merged
merged 4 commits into from
May 22, 2024
Merged

Update docs code demos #201

merged 4 commits into from
May 22, 2024

Conversation

leorudczenko
Copy link
Collaborator

@leorudczenko leorudczenko commented May 22, 2024

Summary

This merge request moves all of the code demo snippets in the docs/ from their .rst files into individual Python files in docs/code_demos/. These are then included in the pages using the sphinx method literalinclude. This means that it is easier for us to spot formatting errors in these scripts, largely because now we can run them against flake8.

Description

For this to be achieved, a number of changes have been made to the directory structure in docs/ regarding Python files:

  • A new directory has been made to store demo scripts: docs/code_demos/, with individual directories within it for each page: e.g. docs/code_demos/load/
  • All existing demo scripts have been moved into their respective sub-directory within docs/code_demos/
  • All code snippets included in .rst files which were considered a complete script (i.e. included correct imports for it to work) have been put into individual Python scripts in their respective sub-directory within docs/code_demos/

Some additional changes have also been made to support these changes:

  • Many minor fixes have been made to code snippets and .rst files including these snippets
  • All code snippets which are in individual Python files within docs/code_demos/ have been updated to be flake8 compliant
  • The flake8 configuration has been updated to account for linting docs/code_demos/

Acceptance Criteria

  • When building the docs locally with sphinx-build -a docs/ docs/_build, all pages which include code snippets should include the correct Python file

@leorudczenko leorudczenko requested a review from volcan01010 May 22, 2024 10:17
@leorudczenko leorudczenko added the documentation Improvements or additions to documentation label May 22, 2024
@volcan01010
Copy link
Collaborator

I built the docs locally and it all worked. Nice one! I like the little module-level docstrings at the top of each file.

@volcan01010 volcan01010 merged commit 3764bb6 into main May 22, 2024
4 checks passed
@leorudczenko leorudczenko deleted the update-docs-code-demos branch June 24, 2024 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants